package com.lanhai.enums;

public enum AgvState {
	XS(1, "行驶"),
	DD(2, "到达"),
	KCS(3, "可传输"),
	CD(4, "充电"),
	JG(5, "交管"),
	TZ(6, "停止"),
	BZ(7, "避障"),
	JT(8, "急停"),
	SCC(9, "上层传出"),
	SCCW(10, "上层传出完成"),
	SCR(11, "上层传入"),
	SCRW(12, "上层传入完成"),
	XCC(13, "下层传出"),
	XCCW(14, "下层传出完成"),
	XCR(15, "下层传入"),
	XCRW(16, "下层传入完成"),
	SCXR(17, "上出下入中"),
	SCXRW(18, "上出下入完成"),
	SRXC(19, "上入下出中"),
	SRXCW(20, "上入下出完成"),
	SZC(21, "上左传出"),
	SZCW(22, "上左传出完成"),
	SZR(23, "上左传入"),
	SZRW(24, "上左传入完成"),
	SRC(25, "上右传出"),
	SRCW(26, "上右传出完成"),
	SRR(27, "上右传入"),
	SRRW(28, "上右传入完成"),
	XZC(29, "下左传出"),
	XZCW(30, "下左传出完成"),
	XZR(31, "下左传入"),
	XZRW(32, "下左传入完成"),
	XRC(33, "下右传出"),
	XRCW(34, "下右传出完成"),
	XRR(35, "下右传入"),
	XRRW(36, "下右传入完成"),
	DM(37, "待命"),
	LX(38, "离线"),
	ZXWC(39, "装卸完成");
	
	private AgvState(Integer code, String name){
		this.code = code;
		this.name = name;
	}
	private Integer code;
	private String name;
	public Integer getCode() {
		return code;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
    public static String getValueByCode(Integer code){
        for(AgvState as:AgvState.values()){
            if(code == as.getCode()){
                return as.getName();
            }
        }
        return  null;
    }

    public static AgvState getAgvStateByCode(Integer code){
    	AgvState as = null;
    	switch (code) {
    	case 1:
    		as = AgvState.XS;//行驶
    		break;
    	case 2:
    		as = AgvState.DD;//到达
    		break;
    	case 3:
    		as = AgvState.KCS;//可传输
    		break;
    	case 4:
    		as = AgvState.CD;//充电
    		break;
    	case 5:
    		as = AgvState.JG;//交管
    		break;
    	case 6:
    		as = AgvState.TZ;//停止
    		break;
    	case 7:
    		as = AgvState.BZ;//避障
    		break;
    	case 8:
    		as = AgvState.JT;//急停
    		break;
    	case 9:
    		as = AgvState.SCC;//上层传出
    		break;
    	case 10:
    		as = AgvState.SCCW;//上层传出完成
    		break;
    	case 11:
    		as = AgvState.SCR;//上层传入
    		break;
    	case 12:
    		as = AgvState.SCRW;//上层传入完成
    		break;
    	case 13:
    		as = AgvState.XCC;//下层传出
    		break;
    	case 14:
    		as = AgvState.XCCW;//下层传出完成
    		break;
    	case 15:
    		as = AgvState.XCR;//下层传入
    		break;
    	case 16:
    		as = AgvState.XCRW;//下层传入完成
    		break;
    	case 17:
    		as = AgvState.SCXR;//上出下入
    		break;
    	case 18:
    		as = AgvState.SCXRW;//上出下入
    		break;    	
    	case 19:
    		as = AgvState.SRXC;//上入下出中
    		break;      		
    	case 20:
    		as = AgvState.SRXCW;//上入下出完成
    		break;
    	case 21:
    		as = AgvState.SZC;//上左传出
    		break;
    	case 22:
    		as = AgvState.SZCW;//上左传出完成
    		break;    		
    	case 23:
    		as = AgvState.SZR;//上左传入
    		break;    		
    	case 24:
    		as = AgvState.SZRW;//上左传入完成
    		break;    		
    	case 25:
    		as = AgvState.SRC;//上右传出
    		break;    	
    	case 26:
    		as = AgvState.SRCW;//上右传出完成
    		break;
    	case 27:
    		as = AgvState.SRR;//上右传入
    		break;    		
    	case 28:
    		as = AgvState.SRRW;//上右传入完成
    		break;    		
    	case 29:
    		as = AgvState.XZC;//下左传出
    		break;    		
    	case 30:
    		as = AgvState.XZCW;//下左传出完成
    		break;    		
    	case 31:
    		as = AgvState.XZR;//下左传入
    		break;    	
    	case 32:
    		as = AgvState.XZRW;//下左传入完成
    		break;
    	case 33:
    		as = AgvState.XRC;//下右传出
    		break;    		
    	case 34:
    		as = AgvState.XRCW;//下右传出完成
    		break;    		
    	case 35:
    		as = AgvState.XRR;//下右传入
    		break;    		
    	case 36:
    		as = AgvState.XRRW;//下右传入完成
    		break;
    	case 37:
    		as = AgvState.DM;//待命
    		break;    	    		
    	case 38:
    		as = AgvState.LX;//离线
    		break;    	    	  
    	case 39:
    		as = AgvState.ZXWC;//装卸完成
    		break;
    		
    	}
    	return as;
    }
    
}
